package com.chixing.ih.module.programmer.mapper;

import com.chixing.ih.common.IhRepository;
import com.chixing.ih.module.programmer.mapper.provider.ProCommunityMapperProvider;
import com.chixing.ih.module.programmer.pojo.ProCommunity;
import org.apache.ibatis.annotations.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘岩
 * Date: 2020-09-29
 * Time: 23:44
 *
 * @version 1.0
 */
@Mapper
public interface ProCommunityMapper extends IhRepository<ProCommunity> {

    @UpdateProvider(type = ProCommunityMapperProvider.class, method = "updateOne")
    int updateOne(ProCommunity proCommunity);

    @SelectProvider(type = ProCommunityMapperProvider.class, method = "getOne")
    @Results(id = "proCommunityMap", value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "user_id", property = "userId"),
            @Result(column = "github_url", property = "githubUrl"),
            @Result(column = "know_url", property = "knowUrl"),
            @Result(column = "stackoverflow_url", property = "stackoverflowUrl"),
            @Result(column = "dribbble_url", property = "dribbbleUrl"),
            @Result(column = "create_time", property = "createTime"),
            @Result(column = "update_time", property = "updateTime"),
    })
    ProCommunity getOne(long userId);

//    @InsertProvider(type = ProCommunityMapperProvider.class, method = "insertOne")
//    int insertOne(ProCommunity proCommunity);

//    @DeleteProvider(type = ProCommunityMapperProvider.class, method = "deleteOneById")
//    int deleteOne(int id);

    @InsertProvider(type = ProCommunityMapperProvider.class, method = "insertUserId")
    int insertUserId(long userId);


}
